﻿<phone:PhoneApplicationPage 
    x:Class="DCView.MainPanorama"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:my="clr-namespace:DCView"
    xmlns:cs="clr-namespace:CS.Windows.Controls;assembly=CS.Windows.Controls"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    shell:SystemTray.Opacity="0.0">
    
    <phone:PhoneApplicationPage.Resources>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot에는 다른 모든 페이지 내용이 배치되는 루트 표가 포함됩니다.-->
    <Grid x:Name="LayoutRoot" Language="ko-kr">
        <controls:Panorama x:Name="PanoramaMain" SelectionChanged="PanoramaMain_SelectionChanged">
            <controls:Panorama.Title>                
                <TextBlock Margin="-20,15,0,-15" FontFamily="Microsoft NeoGothic">
                    <TextBlock.Foreground>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="White" Offset="0" />
                            <GradientStop Color="{StaticResource DCViewAccentColor}" Offset="0.419" />
                            <GradientStop Color="White" Offset="1" />
                        </LinearGradientBrush>
                    </TextBlock.Foreground>
                    <Bold>DCView</Bold>
                </TextBlock>
            </controls:Panorama.Title>
            
            <!--Panorama 항목 1-->
            <controls:PanoramaItem Header="즐겨찾기" x:Name="PanoramaFavorite">

                <ListBox x:Name="Favorites">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="0, 3, 0, 3">
                                <TextBlock Tap="Favorites_Tap" Tag="{Binding}" Text="{Binding DisplayName}" Style="{StaticResource PhoneTextLargeStyle}" 
                                           HorizontalAlignment="Stretch"
                                           toolkit:TiltEffect.IsTiltEnabled="True">
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu>
                                            <toolkit:MenuItem Header="제거" Tag="{Binding}" Click="RemoveFavorite"/>
                                            <toolkit:MenuItem Header="시작 화면에 고정" Tag="{Binding}" Click="PinStartPage_Click"/>
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                </TextBlock>
                                <TextBlock Tag="{Binding}" Text="{Binding SiteID}" Style="{StaticResource PhoneTextSmallStyle}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>                    
                </ListBox>
            </controls:PanoramaItem>

            <!--Panorama 항목 2-->
            <controls:PanoramaItem x:Name="PanoramaAll">
                <!--controls:PanoramaItem.Header>
                    <TextBlock>전체</TextBlock>
                </controls:PanoramaItem.Header-->
                
                <Grid>                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <!--<Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>-->

                    <StackPanel Grid.Row="0">
                        <toolkit:ListPicker x:Name="SearchSite"
                            Grid.Row="0" Grid.Column="0" SelectionChanged="SearchSite_SelectionChanged">
                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}"/>
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                        </toolkit:ListPicker>

                        <cs:WatermarkTextBox x:Name="SearchBox" 
                                    Grid.Row="0" Grid.Column="1" WatermarkText="검색어를 입력하세요"
                                    TextChanged="SearchBox_TextChanged" KeyUp="SearchBox_KeyUp" />
                    </StackPanel>

                    <ListBox x:Name="SearchResult" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="12,12" >
                                    <TextBlock Tag="{Binding}" Tap="SearchResult_Tap" 
                                           Style="{StaticResource PhoneTextLargeStyle}" 
                                           Margin="0"
                                           VerticalAlignment="Center" 
                                           Text="{Binding Name}" >
                                        
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu>
                                                <toolkit:MenuItem Header="즐겨찾기" Tag="{Binding}" Click="AddFavorite_Click"/>
                                                <toolkit:MenuItem Header="시작 화면에 고정" Tag="{Binding}" Click="PinStartPageGallery_Click"/>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                    </TextBlock>
                                           
                                           
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    
                    <StackPanel x:Name="RefreshPanel" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
                        
                        <TextBlock Style="{StaticResource PhoneTextLargeStyle}" Margin="6">갤러리 목록 갱신 중...</TextBlock>
                        <TextBlock x:Name="RefreshStatus" HorizontalAlignment="Center" Style="{StaticResource PhoneTextNormalStyle}"></TextBlock>
                        <ProgressBar x:Name="RefreshProgress" Minimum="0" Maximum="100"></ProgressBar>
                        
                    </StackPanel>
                    

                </Grid>                
            </controls:PanoramaItem>

            <controls:PanoramaItem x:Name="PanoramaSetting" Header="설정">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" Margin="0, 0, 10, 0">
                        <CheckBox x:Name="PassiveLoadImgCheckBox" Content="이미지 수동으로 불러오기" Tap="PassiveLoadImage" />
                        <CheckBox x:Name="FontSizeCheckBox" Content="목록/내용 글씨 크게" Tap="FontSizeCheckBox_Tap"/>
                        <TextBlock Text="패턴 관리"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Button Content="초기화" x:Name="PatternResetButton" Grid.Column="0" Click="PatternReset_Click" Margin="0,1,0,-1"/>
                            <Button Content="업데이트" x:Name="PatternUpdateButton" Grid.Column="1" Click="PatternUpdate_Click"/>
                        </Grid>
                    </StackPanel>

                    <RichTextBox Grid.Row="1" VerticalAlignment="Top" Margin="0, 0, 0, 20" >
                        <RichTextBox.Blocks>
                            <Paragraph>DCView 1.4.5, Copyright © &lt;IOKLO 2012
                                <LineBreak />
                                <Hyperlink Click="Hyperlink_Click">http://dcview.codeplex.com/</Hyperlink>
                            </Paragraph>
                        </RichTextBox.Blocks>
                    </RichTextBox>

                </Grid>                
            </controls:PanoramaItem>

        </controls:Panorama>

    </Grid>

    <!--Panorama 기반 응용 프로그램에서는 ApplicationBar를 표시하지 않아야 합니다.-->
    

</phone:PhoneApplicationPage>